package com.jtny.nytb.equipment.vo.dataparam;

import cn.hutool.core.util.ObjectUtil;
import com.jtny.component.entity.BaseDTO;
import com.jtny.component.util.BeanUtils;
import com.jtny.nytb.config.datafactor.dto.ConfigAlarmDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 报警数据
 *
 * @author 智慧能源中心 - 伍天宇
 * @package com.jtny.nytb.energymonitor.equipment.vo.dataparam
 * @fileName ConfigAlarmVO.java
 * @createTime 2023年09月20日 09:34
 * @Copyright© 2023 jtny
 * 江投能源技术研究院 版权所有
 */
@Data
@ApiModel("报警数据")
@NoArgsConstructor
@AllArgsConstructor
public class AlarmVO extends BaseDTO implements Serializable {
    @ApiModelProperty("报警id")
    private Long alarmId;
    @ApiModelProperty("报警名称")
    private String alarmName;
    @ApiModelProperty("报警类型")
    private String alarmType;
    @ApiModelProperty("报警条件")
    private String alarmCondition;
    @ApiModelProperty("报警内容")
    private String alarmDescribe;
    @ApiModelProperty("报警等级")
    private String alarmClass;

    public ConfigAlarmDTO buildDTO() {
        return BeanUtils.copyToObject(this, ConfigAlarmDTO.class);
    }

    public AlarmVO(ConfigAlarmDTO dto) {
        if (ObjectUtil.isNull(dto)) {
            return;
        }
        this.alarmId = dto.getAlarmId();
        this.alarmName = dto.getAlarmName();
        this.alarmType = dto.getAlarmType();
        this.alarmCondition = dto.getAlarmCondition();
        this.alarmDescribe = dto.getAlarmDescribe();
        this.alarmClass = dto.getAlarmClass();
    }
}
